<!--#include file="conn.asp"-->
<!--#include file="chkuser.asp"-->
<%
call adminRight(8)

ID=request("ID")
AllID=request("chk")

if request("action")="Del" then
	if ID=1 then
		alert("admin用户不可删除!")
		Go("Admin_User.asp")
		response.End()
	end if
	sql="Delete from Admin_lt_jt_wjk where ID="&ID
	conn.execute(sql)
	Go("?showMsgStr=<br><b>管理员已删除成功！</b>|parent|3000|500||")
end if
if request("action")="delall" then
	If AllID="" Then Alert("没有选择数据"):GoBack():response.End()
	if instr(AllID,",")<=0 then
		if clng(AllID)=1 then
		  alert("admin用户不可删除!")
		  Go("Admin_User.asp")
		  response.End()
		end if
	else	
    	arrAllID=split(AllID,",")
		for arrAllID_i=0 to ubound(arrAllID)
			if clng(arrAllID(arrAllID_i))=1 then
			  alert("admin用户不可删除!")
			  Go("Admin_User.asp")
			  response.End()
			end if
		next 
	end if
	sql="delete from Admin_lt_jt_wjk where ID in("&AllID&")"
	conn.execute(sql)
	Go("?showMsgStr=<br><b>管理员已批量删除成功！</b>|parent|3000|500||")
end if

%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>管理员管理</title>
<link href="style.css" rel="stylesheet" type="text/css" />

<script language="javascript" type="text/javascript">
function selcheck(id) {
   var e =document.getElementById(id);
   var objs = e.getElementsByTagName("input");
   if (e.checked){
      e.checked = false;
      for(var i=0; i<objs.length; i++) {
         if(objs[i].type.toLowerCase() == "checkbox" )
         objs[i].checked = false;
      }
   }   else   {
      e.checked = true;
      for(var i=0; i<objs.length; i++) {
         if(objs[i].type.toLowerCase() == "checkbox" )
         objs[i].checked = true;
      }
   }
}
</script>
</head>
<body>
    <div id="frame_Toolbar" class="toolbarBg"> 
		<a href="javascript:self.history.back();" class="icoBtn_ct"><span class="btnIco btnBack"></span>返回</a> 
		<a href="javascript:self.location.reload();" class="icoBtn_ct"><span class="btnIco btnReload"></span>刷新</a> 
		<span class="split ftSplit" ></span>
	    <div id="guide">点击<span class="light_orange"> 用户名 </span>进行权限设置(<font color="#FF0000">为了系统正常使用，admin权限不可修改，也不可删除！</font>)</div>
		<%
			   Set rs = Server.CreateObject("ADODB.Recordset")
			   sql="select * from Admin_lt_jt_wjk order by id desc"
			   rs.open sql,conn,1,1
	    %>
	    <div class="pageInfo right light_gray">[当前共有<span id="Label_total_top" class="light_bOrange"><%=rs.recordcount%></span>条记录]</div>
		<%
		      rs.close
			  set rs=nothing
		%>
    </div>
	<form method="POST" id="form2" name="form2" action="">
	<div id="MainContent">
     <table class="cTable table tCenter">
	    <tr class="cTitle toolbarBg" id="Title">
		    <td width="7%"><span class="checkbox"><input type="checkbox" name="chkall" onClick="selcheck('MainContent')" /></span></td>
		    <td width="10%"><span class="split ctSplit"></span><div>序号</div></td>
		    <td width="30%"><span class="split ctSplit"></span><div>用户名</div></td>
		    <td width="33%"><span class="split ctSplit"></span><div>注册时间</div></td>
		    <td width="20%"><span class="split ctSplit"></span><div>确认操作</div></td>
	    </tr>
	 </table>
	<table class="cTable table tCenter" cellspacing="0" border="0" style="border-collapse:collapse;">
	    <%
		   Set rs = Server.CreateObject("ADODB.Recordset")
		   sql="select * from Admin_lt_jt_wjk order by id desc"
		   rs.open sql,conn,1,1
		   rs.pagesize=14
		   curpage=Request.QueryString("curpage")
		   if curpage="" then curpage=1
		   if not rs.eof then rs.absolutepage=curpage
		   for i=1 to rs.pagesize
		   if rs.eof then
		   exit for
		   end if
	 %>
		<tr class="trDataList" onMouseOver="this.className='trDataListHover'" onMouseOut="this.className='trDataList'">
			<td align="center" style="width:7%;white-space:nowrap;">
        <input type="checkbox" name="chk" value="<%=rs("ID")%>" id="<%=rs("ID")%>" />
			</td>
			<td align="center" style="width:10%;white-space:nowrap;"><span><%=rs("ID")%></span></td>
			<td style="width:30%;">
				<%if session("SYSUserID")=1 then%>
					<%if rs("ID")=1 then%>
						<%=rs("admin_User_wjk")%>
					<%else%>
						<a href="Admin_User_Right.asp?ID=<%=rs("ID")%>"><%=rs("admin_User_wjk")%></a>
					<%end if%>
				<%else%>
					<%=rs("admin_User_wjk")%>
				<%end if%>
			</td>
			<td style="width:33%;"><%=rs("admin_Adddate")%></td>
			<td style="width:20%;">
				<a href="Admin_User_Edit.asp?ID=<%=rs("ID")%>">修改密码</a><%if rs("id")>1 then%>/<a href="?ID=<%=rs("ID")%>&action=Del" onClick="return confirm('确定删除？')">删除</a><%end if%>
			</td>
		</tr>
		<%
			rs.movenext
			next
        %>	
	</table> 
    <div id="cEndToolbar" class="toolbarBg">
        <div class="pageList">
				<%
				set pageObj=new pager
				response.Write pageObj.link(rs.recordcount,rs.pagesize,curpage,"?curpage=",qryString)
				%>
		<%
			rs.close
			Set rs=nothing
		 %>
	    </div>
	    <div class="pageSelect"><span class="iptSl"><input type="checkbox" name="chkall" onClick="selcheck('MainContent')" /></span><a href="javascript:selcheck('MainContent');"><span class="btnTxt">选择</span></a></div>
	    <span class="split cpSplit" ></span>
	    <div class="pageBtnDo">
	        <div class="icoBtn_do"><input type="image" name="Delete_Button" id="Delete_Button" class="btnIco btnDel" src="images/Empty.gif" onClick="document.form2.action='?action=delall';return confirm('确定要删除吗?');" style="border-width:0px;" /></div>
	    </div>
	</div>	
    </div>
	</form>
</body>
</html>